using System;
using System.Collections.Generic;
using System.Text;
using FlatRedBall;
using FlatRedBall.Input;
using FlatRedBall.AI.Pathfinding;
using FlatRedBall.Graphics.Animation;
using FlatRedBall.Graphics.Particle;

using FlatRedBall.Graphics.Model;
using FlatRedBall.Math.Geometry;
using FlatRedBall.Math.Splines;

using Cursor = FlatRedBall.Gui.Cursor;
using GuiManager = FlatRedBall.Gui.GuiManager;
using Microsoft.Xna.Framework.Input;

#if FRB_XNA || SILVERLIGHT
using Keys = Microsoft.Xna.Framework.Input.Keys;
using Vector3 = Microsoft.Xna.Framework.Vector3;
using Texture2D = Microsoft.Xna.Framework.Graphics.Texture2D;
using Gnome.Engine;
#endif

namespace Gnome.Screens
{
	public partial class SplashScreen
	{
        const float SECONDS_ON_SCREEN = 7.0f;
        float timeCount;
		public void CustomInitialize()
		{
            SplashScreenBackground.ScaleX = LevelBase.SCREEN_WIDTH / 2;
            SplashScreenBackground.ScaleY = LevelBase.SCREEN_HEIGHT / 2;
            SplashScreenBackground.Z = 1;
            timeCount = 0.0f;
		}

		public void CustomActivity(bool firstTimeCalled)
		{
            if (CustomInputManager.isMenuSelect() || CustomInputManager.isMenuCancel())
            {
                timeCount += SECONDS_ON_SCREEN + 1;
            }
            /*
            if (InputManager.Keyboard.KeyPushed(Keys.P))
            {
                IsActivityFinished = true;
                MoveToScreen(typeof(Gnome.Screens.LevelOne).FullName);
            }
             * */
 
            timeCount += TimeManager.SecondDifference;

            float percentDone = timeCount / SECONDS_ON_SCREEN;

            float stretchToBetweenPi = (float) (percentDone * Math.PI);

            SplashScreenBackground.Alpha = (float) Math.Pow(Math.Sin(stretchToBetweenPi), 3);
            if (timeCount > SECONDS_ON_SCREEN)
            {
                IsActivityFinished = true;
                MoveToScreen(typeof(Gnome.Screens.MainMenu).FullName);
            }
		}

		public void CustomDestroy()
		{


		}

        private static void CustomLoadStaticContent(string contentManagerName)
        {


        }

	}
}
